package com.zhentao.controller;

import com.zhentao.model.common.buiness.dto.BuUserLoginDto;
import com.zhentao.model.common.buiness.pojo.BuUser;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.BuUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/buiness/log")
@Api(tags = "user",description = "商家端登入")
public class BuUserLoginController {
    @Autowired
    private BuUserService buUserService;
    @PostMapping("/in")
    @ApiOperation("商家端登入接口")
    public ResponseResult buUserLogin(@RequestBody BuUserLoginDto dto){
      return  buUserService.buUserLogin(dto);
    }

    /**
     * 商家端：根据用户id查询
     * @param id
     * @return
     */
    @PostMapping("/userById/{id}")
    @ApiOperation("商家端：用户信息")
    public ResponseResult userById(@PathVariable("id")Integer id){
        return buUserService.userById(id);
    }


    /**
     * 商家端：修改用户信息
     * @param buUser
     * @return
     */
    @PostMapping("/userUpdate")
    @ApiOperation("商家端：修改用户信息")
    public ResponseResult updateUser(@RequestBody BuUser buUser){
        return buUserService.updateUser(buUser);
    }
    @PostMapping("/zhuce")
    public ResponseResult zhuce(@RequestBody BuUserLoginDto dto){
      return   buUserService.userregist(dto);
    }
}
